//package com.hyzh.latte.config;
//
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.web.cors.CorsConfiguration;
//import org.springframework.web.cors.reactive.CorsWebFilter;
//import org.springframework.web.cors.reactive.UrlBasedCorsConfigurationSource;
//import org.springframework.web.util.pattern.PathPatternParser;
//
//@Configuration
//public class FanGateWayCorsConfigure {
//
//    /**
//     * setAllowCredentials(true)表示允许cookie跨域；
//     * addAllowedHeader(CorsConfiguration.ALL)表示请求头部允许携带任何内容；
//     * addAllowedOrigin(CorsConfiguration.ALL)表示允许任何来源；
//     * addAllowedMethod(CorsConfiguration.ALL)表示允许任何HTTP方法。
//     */
//    @Bean
//    public CorsWebFilter corsFilter() {
//        UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(new PathPatternParser());
//        CorsConfiguration corsConfiguration = new CorsConfiguration();
//        corsConfiguration.setAllowCredentials(true);
//        corsConfiguration.addAllowedOrigin(CorsConfiguration.ALL);
//        corsConfiguration.addAllowedHeader(CorsConfiguration.ALL);
//        corsConfiguration.addAllowedMethod(CorsConfiguration.ALL);
//        source.registerCorsConfiguration("/**", corsConfiguration);
//        return new CorsWebFilter(source);
//    }
//}
